package org.sunyaxing.transflow.transflowapp.common.logback;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.AbstractMatcherFilter;
import ch.qos.logback.core.spi.FilterReply;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

public class AgentMsgFilter extends AbstractMatcherFilter<ILoggingEvent> {
    public static final String MARKER_SIGN = "AgentMsgFilter";
    public static final Marker MARKER = MarkerFactory.getMarker(MARKER_SIGN);

    @Override
    public FilterReply decide(ILoggingEvent event) {
        if (!isStarted()) {
            return FilterReply.DENY;
        }
        return MARKER.equals(event.getMarker()) ? this.onMatch : FilterReply.DENY;
    }

    public void start() {
        super.start();
    }
}
